package com.dq.statistics.schedule;

import com.dq.commonutils.utils.DateUtil;
import com.dq.statistics.service.StatisticsDailyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @project: guli_parent
 * @ClassName: SheduleTask
 * @author: dq
 * @creat: 2022/9/17 16:31
 */
@Component
public class ScheduleTask {
@Autowired
private StatisticsDailyService staService;

    @Scheduled(cron = "0 30 1 1/1 * ?")
    public void autoInsertRegisterPeople(){
        //生成上一天的时间  2022-09-07
        String formatDate = DateUtil.formatDate(DateUtil.addDays(new Date(), -1));
        staService.registerCount(formatDate);
    }
}
